<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>全文检索</title>
    <#include "../commonFile/quote.ftl"/>
    <style>
        body,html{
            height:99%;
        }
        div.search input{
            width:280px;
            height:32px;
            outline:none;
            border-radius:3px;
            border:1px solid #ccc;
            padding-left:10px;
            box-sizing:border-box;
        }
        div.search{
            width: 100%;
            height:60px;
            text-align: center;
        }
        div.search button{
            height: 32px;
            width: 60px;
            position: relative;;
            top: -2px;
            left:-7px;
        }
        div.searchResult{
            width:100%;
            height:35px;
            background-color: #046DA6;
        }
        div.searchResult span{
            color: #fff;
            position: relation;
            position: relative;
            left: 10px;
            top: 8px;
        }
    </style>
</head>
<body>
    <h5>首页》全文检索</h5>
    <hr style="width:100%;height:1px;border:none;border-top:1px solid #D0D0D0;"/>
    <div class="search">
        <input id="search" name="search" type="text" placeholder="请输入关键字" autocomplete="off" />
        <button  type="button" class="btn btn-primary btn-sm" onclick="searchBtn()">搜索</button>
    </div>
    <div class="searchResult">
        <span>检索结果</span>
    </div>
    <table id="table" class="table table-condensed"></table>
</body>
<script type="application/javascript" src="/plugins/layer/layer.js"></script>
<script>
    $(function(){
        tableUtil.initTable();
    });
    var tableUtil = {
        initTable:function(){
            $("#table").bootstrapTable({
                method: "GET",
                cache: false,
                striped: true,           //表格显示条纹
                pagination: false,        //在底部显示分页组件
                pageSize: 5,             // 页面数据条数
                pageNumber: 1,            // 首页页码
                sidePagination: 'server', // 设置为服务器端分页
                queryParamsType: '',
                queryParams:function (params){   //请求服务器数据时，添加额外参数
                    return {
                        pageSize:params.pageSize, // 每页要显示的数据条数
                        pageNum:params.pageNumber    // 页码
                    }
                },
                idField:'id',             //指定主键列
                columns:[{
                    checkbox: true,   //显示一个勾选框
                    align: 'center',   //居中显示
                    valign: 'middle'
                },{
                    field:'filename',
                    title:'文档名称',
                    align:'center',
                    valign: 'middle',
                },{
                    field:'path',
                    title:'路径地址',
                    align:'center',
                    valign: 'middle'
                },{
                    field:'orgid',
                    title:'所属部门',
                    align:'center',
                    valign: 'middle'
                },{
                    field:'',
                    title:'权限',
                    align:'center',
                    valign: 'middle',
                    width:'250px',
                    formatter:function(value,row,index){
                        var result = "";
                        result += "<button style='margin-left:10px;' type='button' class='btn btn-primary btn-xs' onclick='dopdfView()'>在线预览</button>";
                        result += "<button style='margin-left:10px;' type='button' class='btn btn-primary btn-xs' onclick=''>下载</button>";
                        result += "<button style='margin-left:10px;' type='button' class='btn btn-primary btn-xs' onclick=''>申请借阅</button>";
                        return result;
                    }
                }
                ]
            });
        }
    }
    //搜索按钮
    function searchBtn(){
       var search = $("#search").val();
       $('#table').bootstrapTable('refresh',{
           url:'/fullSearch/selectByFullSearch',
           query : { keywords : search }
       })
    }
    //在线预览
    function dopdfView(){
         window.open("/plugins/pdfJS/web/viewer.html");
    }
</script>
</html>
